package com.cirkana.viewer.data.criteria;

import java.util.ArrayList;

import com.cirkana.data.IDataCriteria;

public abstract class DataCriteria implements IDataCriteria {

	protected static final String OPERATOR_EQUALS = "=";

	protected String column;
	protected String operator;
	protected Object value;

	protected DataCriteria(String column, String operator, Object value) {
		this.column = column;
		this.operator = operator;
		this.value = value;
	}

	@Override
	public String getColumn() {
		return this.column;
	}

	@Override
	public String getOperator() {
		return this.operator;
	}

	@Override
	public Object getValue() {
		return this.value;
	}

	public static StringEqualsDataCriteria getStringEqualsDataCriteria(
			String column, String value) {
		return new StringEqualsDataCriteria(column, value);
	}
	
	public static IdDataCriteria getIdDataCriteria(String column, Integer id) {
		return new IdDataCriteria(column, id);
	}

	public static ArrayList<IDataCriteria> getDataCriteriaList(
			DataCriteria... criterion) {
		ArrayList<IDataCriteria> list = new ArrayList<IDataCriteria>();
		for (DataCriteria criteria : criterion)
			list.add(criteria);
		return list;
	}
}
